package com.popcap.widgets;

import java.util.ArrayList;
import java.util.List;

public class Method
{
	private List<String[]> customArgs = new ArrayList<String[]>();
	private String returnType;
	private String name;
	private String defaultTarget;
	
	public Method(String returnType, String name, String defaultName)
	{
		this.returnType = returnType;
		this.name = name;
		this.defaultTarget = defaultName;
	}
	
	public String customArgsDefinition()
	{
		StringBuffer result = new StringBuffer(256); 
		for(String[] argument : customArgs)
		{
			result.append(", ");
			result.append(argument[0]).append(" ").append(argument[1]);
		}
		return result.toString();
	}
	
	public String customArgsCall()
	{
		StringBuffer result = new StringBuffer(256); 
		for(String[] argument : customArgs)
		{
			result.append(", ");
			result.append(argument[1]);
		}
		return result.toString();
	}
	
	public void addCustomArgument(String type, String name)
	{
		customArgs.add(new String[]{type, name});
	}
	
	public String getReturnType()
	{
		return returnType;
	}

	public void setReturnType(String returnType)
	{
		this.returnType = returnType;
	}

	public String getName()
	{
		return name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public String getDefaultTarget()
	{
		return defaultTarget;
	}

	public void setDefaultTarget(String defaultName)
	{
		this.defaultTarget = defaultName;
	}
}
